<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%
	String port = request.getServerPort() == 80 ? "" : ":".concat(request.getServerPort()+"");
	String path = request.getScheme().concat("://").concat(request.getServerName()).concat(port).concat(request.getContextPath());
	request.setAttribute("path", path);
%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html>
<html>
<head>
<title>我的收藏 - 个人中心 - IT答案网</title>
<meta name="keywords" content="我的收藏" />
<meta name="description" content="我的收藏" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="${path }/view/portal/css/all.css" rel="stylesheet">
<link href="${path }/view/portal/css/prettify.css" rel="stylesheet">
<script src="${path }/view/portal/js/all.js"></script>
</head>
<body>
  <jsp:include page="head.jsp"></jsp:include>
  <div class="container container1000">
	<div class="content">
		
		<form class="breadcrumb form-search" style="margin-bottom:10px" action="#">
			<div>
				<label></label>
				<input type="text" maxlength="50" class="input-medium" placeholder="标题" name="title" value="${param.title }">
				&nbsp;
				<select name="groupId" id="groupId">
				   <option value="">全部收藏夹</option>
				</select>
				&nbsp;
				<input type="submit" value="查询" class="btn">
			</div>
		</form>
		<shiro:hasRole name="admin">
		<input type="button" class="btn btn-small btn-danger" value="删除" 
			onclick="doBatch('ids', '${ctx}/user/user/delete?ids=');">
	    </shiro:hasRole>
		<table class="table table-bordered table-striped table-condensed">
			<thead>
				<tr>
				    <shiro:hasRole name="admin">
					<th class="span1">
						<input type="checkbox" id="selectall" name="selectall" 
							onclick="selectAll('selectall', 'ids')">
					</th>
					</shiro:hasRole>
					<th>标题</th>
					<th>收藏时间</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${page.datas }" var="data">
					<tr>
						<shiro:hasRole name="admin"><td><input type="checkbox" name="ids" value="${data.id }"></td></shiro:hasRole>
						<td>
							<a href="${data.url }" title="${data.title }" target="_blank">
								${data.title }
							</a>
						</td>
						<td>
							<fmt:formatDate value="${data.createDate }" pattern="yyyy-MM-dd HH:mm:ss"/>
						</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
	
	</div>
	<c:set var="params" value="title=${page.conditions.title }&"/> 
      <%@ include file="/view/user/pagination.jsp"%>
   </div>

<script src="${ctx}/view/user/js/common.js"></script>

<div class="clear">&nbsp;</div>
   
<script type="text/javascript">

 $(function(){
	   //加载用户的收藏夹列表
	   $.ajax({
		   url:'${path }/user/collection_group/login_list.do',
		   type:'get',
		   dataType:'json',
		   success:function(data){
			   if(data.success == true){
				   $.each(data.data,function(i,val){
					   var op = "";
					   if('${param.groupId}' == val.id+''){
						   op = "<option value='"+val.id+"' selected='selected'>"+val.groupName+"</option>";
					   }else{
						   op = "<option value='"+val.id+"'>"+val.groupName+"</option>";
					   }
					   $("#groupId").append(op);					   
				   });
			   }else{
				   alert(data.msg);
			   }
		   },
		   error:function(data){
			   alert("请求失败");
		   }
	   });	
 })

</script>   
   
<jsp:include page="bottom.jsp"></jsp:include>  
</body>
</html>